/**
 * Created by Administrator on 2017/10/22.
 */

// 管理员登录
function adminLogin(){
        console.log("flag");
        if($("#name").val() ==""){
        alert("用户名不能为空，请输入用户名后继续！");
        $("#name").focus();
        return;
    }
    if($("#password").val() == ""){
        alert("用户密码为空，请输入用户密码后继续！");
        $("#password").focus();
        return;
    }

    var fdata = $("#login_form").serialize();
    $.param(fdata);
    $.ajax({
        url:"../admin/login",
        type:"GET",
        data:fdata,
        contentType:"application/x-www-form-urlencoded; charset=utf-8",
        dataType:"json",
        success:function(result){
           if(result.code==0){
                location.href="./main.html";
            }else if(result.code==1){
                alert(result.message);
            }
        }
    });
}


// 站点登录
function siteLogin(){
    console.log("flag");
    if($("#name").val() ==""){
        alert("用户名不能为空，请输入用户名后继续！");
        $("#name").focus();
        return;
    }
    if($("#password").val() == ""){
        alert("用户密码为空，请输入用户密码后继续！");
        $("#password").focus();
        return;
    }

    var fdata = $("#login_form").serialize();
    $.param(fdata);
    $.ajax({
        url:"../site/login",
        type:"GET",
        data:fdata,
        contentType:"application/x-www-form-urlencoded; charset=utf-8",
        dataType:"json",
        success:function(result){
            if(result.code==0){
                location.href="./main.html";
            }else if(result.code==1){
                alert(result.message);
            }
        }
    });
}


// 商家登录
function sellerLogin(){
    console.log("flag");
    if($("#name").val() ==""){
        alert("用户名不能为空，请输入用户名后继续！");
        $("#name").focus();
        return;
    }
    if($("#password").val() == ""){
        alert("用户密码为空，请输入用户密码后继续！");
        $("#password").focus();
        return;
    }

    var fdata = $("#login_form").serialize();
    $.param(fdata);
    $.ajax({
        url:"../seller/login",
        type:"GET",
        data:fdata,
        contentType:"application/x-www-form-urlencoded; charset=utf-8",
        dataType:"json",
        success:function(result){
            if(result.code==0){
                location.href="./.././plan/main.html";
            }else if(result.code==1){
                alert(result.message);
            }
        }
    });
}







